﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.Caching;
using System.Net;
using System.Net.Mail;

namespace FYPHP
{
    public partial class zTest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void btnSendEmail_Click(object sender, EventArgs e)
        {
            System.Net.Mail.MailMessage MyMailMessage = new System.Net.Mail.MailMessage("hpfyp2012@gmail.com", "ping90@msn.com", "This is the mail subject", "Just wanted to say Hello");

            MyMailMessage.IsBodyHtml = false;
            System.Net.NetworkCredential mailAuthentication = new
            System.Net.NetworkCredential("hpfyp2012@gmail.com", "hpfyp123");
            System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);

            mailClient.EnableSsl = true;
            mailClient.UseDefaultCredentials = false;
            mailClient.Credentials = mailAuthentication;
            mailClient.Send(MyMailMessage);
        }
    }
}